# DjangoDE, an integrated development environment for Django
# Copyright (C) 2010-2011 Andrew Wilkinson
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.

import os

import djangode
from djangode import global_objects
from djangode.utils.qt import QtCore, QtGui

class AboutDialog(QtGui.QDialog):
    def __init__(self, parent=None):
        QtGui.QDialog.__init__(self, parent)

        self.setWindowTitle("About DjangoDE %s" % (djangode.get_version(), ))
        self.setWindowIcon(QtGui.QIcon(global_objects.icon))

        vbox = QtGui.QVBoxLayout(self)

        logo_hbox = QtGui.QHBoxLayout()

        self.logo = global_objects.icon.scaled(100, 100)
        self.logo_label = QtGui.QLabel()
        self.logo_label.setPixmap(self.logo)
        logo_hbox.addWidget(self.logo_label)

        title_vbox = QtGui.QVBoxLayout()

        self.djangode_name = QtGui.QLabel("<h1>DjangoDEs</h1>")
        title_vbox.addWidget(self.djangode_name)

        self.djangode_subtitle = QtGui.QLabel("The Django Development Environment")
        title_vbox.addWidget(self.djangode_subtitle)

        self.djangode_version = QtGui.QLabel("Version %s" % (djangode.get_version(), ))
        title_vbox.addWidget(self.djangode_version)

        logo_hbox.addLayout(title_vbox, 1)
        vbox.addLayout(logo_hbox)

        vbox.insertSpacing(-1, 10)

        self.djangode_copyright = QtGui.QLabel(djangode.COPYRIGHT)
        vbox.addWidget(self.djangode_copyright)

        self.djangode_license = QtGui.QLabel("Released under the terms of the GNU GPL v2")
        vbox.addWidget(self.djangode_license)

        self.close_button = QtGui.QPushButton("Close")
        self.close_button.setDefault(True)
        self.close_button.clicked.connect(self.close)
        vbox.addWidget(self.close_button, 0, QtCore.Qt.AlignRight)
